﻿using System;
using System.Security.Cryptography;

namespace ooWii.Security
{
	public class SHA1Engine : IDisposable
	{
		#region SHA1Engine

		public SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();

		public static bool CompareSHA1( byte[] sha1, int offset1, byte[] sha2, int offset2 )
		{
			for( int i = 0; i < 20; i++ )
			{
				if( sha1[ i + offset1 ] != sha2[ i + offset2 ] )
				{
					return false;
				}
			}

			return true;
		}

		#endregion

		#region IDisposable

		public void Dispose()
		{
			( (IDisposable)SHA1 ).Dispose();
		}

		#endregion
	}
}
